package com.demo.parallelstream;

import java.util.stream.Stream;

public interface ParallelDemo {
    public static void main(String[] args) {
        long sum = Stream.iterate(1L, i -> i + 1)
                          .limit(10)
                          .parallel()
                          .reduce(0L, Long::sum);
        System.out.println(sum);
    }
}
